package cz.semjob.document.annotation;

import java.util.ArrayList;
import java.util.List;

import cz.semjob.document.annotation.metadata.Entity;

/**
 * Represents one annotated part in text document.
 * @author ivivivi
 *
 */
public class EntityAnnotation implements IAnnotation {
	
	private final Entity type;
	
	private String text;
	
	private final List<AnnotatedPart> annotatedParts;
	
	private final List<EventAnnotation> relatedEvents;
	
	
	
	public EntityAnnotation(Entity type) {
		super();
		this.annotatedParts = new ArrayList<AnnotatedPart>();
		this.relatedEvents = new ArrayList<EventAnnotation>();
		if (type == null) {
			throw new AssertionError("Entity is null");
		}
		this.type = type;
	}
	
	public void addAnnotatedPart(AnnotatedPart part) {
		annotatedParts.add(part);
	}
	
	public void addRelatedEvent(EventAnnotation eventAnnotation) {
		this.relatedEvents.add(eventAnnotation);
	}


	public List<AnnotatedPart> getAnnotatedParts() {
		return annotatedParts;
	}

	public List<EventAnnotation> getRelatedEvents() {
		return relatedEvents;
	}

	public Entity getType() {
		return type;
	}
	
	public void setText(String text) {
		this.text = text;
	}

	public String getText() {
		return text;
	}

	@Override
	public String toString() {
		return "EntityAnnotation [type=" + type + ", text=" + text + "]";
	}
	
	
	
	
	
	
	
	

}
